package com.daoyuan.test;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class HelloWorld {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		System.out.println("Hello, world!");
//		delBlankLine();
		
		/* subClass */
		new HelloWorld().new subClass();
		new HelloWorld().new subClass("What the fuck!");
	}
	
	/* delete blank lines from file */
	static void delBlankLine() throws IOException {
		String sourcefilepath = "D:\\User\\Desktop\\hosts2";
		String resultfilepath = "D:\\User\\Desktop\\hosts3";
		BufferedReader br = new BufferedReader(new FileReader(sourcefilepath));
		BufferedWriter bw = new BufferedWriter(new FileWriter(resultfilepath));
		String line = "";
		while((line=br.readLine())!=null){
			if(!line.trim().equals("")){
//				if(line.startsWith("#")){
//					bw.newLine();
//				}
				bw.append(line);
				bw.newLine();
			}
		}
		bw.close();
		br.close();
	}
	
	/**
	 * @fun test java subclass function
	 * @author daoyuan
	 */
	private class subClass {
		subClass(){
			System.out.println("This is subClass()!");
		}
		subClass(String str){
			System.out.println("This is subClass("+str+")!");
		}
	};
}
